package controller;

import pojo.*;
import service.*;
import vo.ResponseVo;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

public class BusinessController {
    //获取service层对象
    /**
     * @param httpServletRequest
     * @param HttpServletResponse
     * @return
     *  */


    private IBusinessService iBusinessService= ServiceFactory.getIntance("BusinessService");


    public ResponseVo<List<Business>> getBusinessList(HttpServletRequest request, HttpServletResponse response) {
        // 调用service层获取用户列表并返回
        // /BusinessController/getBusinessList
        return iBusinessService.getBusinessList();
    }

    public ResponseVo<Business> findBusinessById(HttpServletRequest request, HttpServletResponse response) {
        String id=request.getParameter("id");
        // 调用service层获取用户列表并返回
        // /BusinessController/findBusinessById?id=
        return iBusinessService.findBusinessById(Integer.parseInt(id));
    }
    public ResponseVo<List<Business>> getTop3BusinessList(HttpServletRequest request, HttpServletResponse response) {
        // 调用service层获取用户列表并返回
        // /BusinessController/getTop3BusinessList
        return iBusinessService.getTop3BusinessList();
    }
    public ResponseVo<List<Business>> findBusinessByOrderTypeId(HttpServletRequest request, HttpServletResponse response) {
        String id=request.getParameter("id");
        // /BusinessController/findBusinessByOrderTypeId?id=
        // 调用service层获取用户列表并返回
        return iBusinessService.findBusinessByOrderTypeId(Integer.parseInt(id));
    }

}
